import request from '@/utils/request'

// 不分页
export function getAddressAll () {
  return request({
    url: '/v01/user/address/list',
    method: 'get'
  })
}

// 分页
export function getAllAddress (page, size) {
  return request({
    url: '/v01/user/address/list',
    method: 'get',
    params: {
      pageIndex: page,
      pageSize: size
    }
  })
}

export function addAddress (data) {
  return request({
    url: '/v01/user/address/create',
    method: 'post',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
    data: data
  })
}

export function updateAddress (id, data) {
  return request({
    url: '/v01/user/address/update',
    method: 'put',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
    params: {
      id: id
    },
    data: data
  })
}
